<template>
  <van-nav-bar :title="title" left-text="返回" left-arrow @click-left="back" />
</template>

<script setup>
import { useRouter, useRoute } from "vue-router";
const router = useRouter(),
  route = useRoute();

const back = () => {
  let { from } = route.query;
  from && from.includes("/detail") ? router.replace(from) : router.go(-1);
};

defineProps({
  title: {
    type: String,
    default: "个人中心",
  },
});
</script>

<style lang="less" scoped>
:deep(.van-icon),
:deep(.van-nav-bar__text) {
  color: #000;
}
</style>